/**
 */
package autoSAR.impl;

import autoSAR.AutoSARPackage;
import autoSAR.Entity;
import autoSAR.PostRecivePPort;
import autoSAR.PostReciveRPort;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.util.EObjectResolvingEList;
import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Post Recive PPort</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * </p>
 * <ul>
 *   <li>{@link autoSAR.impl.PostRecivePPortImpl#getDataFrom <em>Data From</em>}</li>
 *   <li>{@link autoSAR.impl.PostRecivePPortImpl#getPostTo <em>Post To</em>}</li>
 * </ul>
 *
 * @generated
 */
public class PostRecivePPortImpl extends PostRecivePortImpl implements PostRecivePPort {
	/**
	 * The cached value of the '{@link #getDataFrom() <em>Data From</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDataFrom()
	 * @generated
	 * @ordered
	 */
	protected EList<Entity> dataFrom;

	/**
	 * The cached value of the '{@link #getPostTo() <em>Post To</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPostTo()
	 * @generated
	 * @ordered
	 */
	protected EList<PostReciveRPort> postTo;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected PostRecivePPortImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return AutoSARPackage.Literals.POST_RECIVE_PPORT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Entity> getDataFrom() {
		if (dataFrom == null) {
			dataFrom = new EObjectResolvingEList<Entity>(Entity.class, this,
					AutoSARPackage.POST_RECIVE_PPORT__DATA_FROM);
		}
		return dataFrom;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<PostReciveRPort> getPostTo() {
		if (postTo == null) {
			postTo = new EObjectWithInverseResolvingEList.ManyInverse<PostReciveRPort>(PostReciveRPort.class, this,
					AutoSARPackage.POST_RECIVE_PPORT__POST_TO, AutoSARPackage.POST_RECIVE_RPORT__RECIVE_FROM);
		}
		return postTo;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
		case AutoSARPackage.POST_RECIVE_PPORT__POST_TO:
			return ((InternalEList<InternalEObject>) (InternalEList<?>) getPostTo()).basicAdd(otherEnd, msgs);
		}
		return super.eInverseAdd(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
		case AutoSARPackage.POST_RECIVE_PPORT__POST_TO:
			return ((InternalEList<?>) getPostTo()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
		case AutoSARPackage.POST_RECIVE_PPORT__DATA_FROM:
			return getDataFrom();
		case AutoSARPackage.POST_RECIVE_PPORT__POST_TO:
			return getPostTo();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
		case AutoSARPackage.POST_RECIVE_PPORT__DATA_FROM:
			getDataFrom().clear();
			getDataFrom().addAll((Collection<? extends Entity>) newValue);
			return;
		case AutoSARPackage.POST_RECIVE_PPORT__POST_TO:
			getPostTo().clear();
			getPostTo().addAll((Collection<? extends PostReciveRPort>) newValue);
			return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
		case AutoSARPackage.POST_RECIVE_PPORT__DATA_FROM:
			getDataFrom().clear();
			return;
		case AutoSARPackage.POST_RECIVE_PPORT__POST_TO:
			getPostTo().clear();
			return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
		case AutoSARPackage.POST_RECIVE_PPORT__DATA_FROM:
			return dataFrom != null && !dataFrom.isEmpty();
		case AutoSARPackage.POST_RECIVE_PPORT__POST_TO:
			return postTo != null && !postTo.isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //PostRecivePPortImpl
